from kyb_caps import driver, By, sleep
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC

# 输入用户名、输入密码，点击登录
driver.find_element(By.ID, 'com.tal.kaoyan:id/login_email_edittext').send_keys('ammyxh01')
driver.find_element(By.ID, 'com.tal.kaoyan:id/login_password_edittext').send_keys('1')
driver.find_element(By.ID, 'com.tal.kaoyan:id/login_login_btn').click()

# toast定位
toast_loc = (By.XPATH, '//*@text="验证失败次数过多，请15分钟后再试"')
ele_toast = WebDriverWait(driver, 30, 0.5).until(EC.presence_of_element_located(toast_loc))
print(ele_toast.text)

driver.quit()














